package ita.class1.group2.supermarket.customer.service;

import ita.class1.group2.supermarket.common.annotation.Autowired;
import ita.class1.group2.supermarket.common.annotation.Component;
import ita.class1.group2.supermarket.common.pojo.Page;
import ita.class1.group2.supermarket.common.service.BaseService;
import ita.class1.group2.supermarket.customer.dao.ProductDao;
import ita.class1.group2.supermarket.customer.pojo.Product;

import java.util.List;
import java.util.Map;

@Component
public class ProductService implements BaseService<Product, String> {

    @Autowired
    private ProductDao productDao;

    @Override
    public Product find(String s) {
        return null;
    }

    @Override
    public List<Product> findAll() {
        return null;
    }

    @Override
    public Product save(Product product) {
        return null;
    }

    @Override
    public boolean delete(String s) {
        return false;
    }

    @Override
    public List<Product> findByCondition(Map map) {
        return null;
    }

    @Override
    public boolean update(Product product) {
        return false;
    }

    public Page<Product> findProductsBySId(String sId, Integer pageIndex, Integer pageCount){
        int total = productDao.findProductsCountBySId(sId);
        List<Product> products = productDao.findProductsBySId(sId,pageIndex,pageCount);
        Page<Product> page = new Page<>(pageIndex,pageCount,products,total);
        return page;
    }
}
